package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.vo.Comment;
import cn.tedu._04mybatis.pojo.vo.CommentVO1;
import cn.tedu._04mybatis.pojo.vo.CommentVO2;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface CommentMapper {
    @Insert("INSERT INTO comment(id,content,created,user_id,weibo_id) VALUES (#{id},#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);
    @Delete("DELETE FROM comment WHERE id=#{wid}")
    int deleteComment(Long wid);
    @Select("SELECT content,user_id userId,weibo_id weiboId FROM comment WHERE id=#{id}")
    CommentVO1 selectComment(Long id);
    @Select("SELECT content,user_id userId FROM comment WHERE weibo_id=#{weiboId}")
    List<CommentVO2> selectCommentByWeiboId(Long weiboId);

}
